package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.GradeBean;
import com.project.bean.RoleBean;
import com.project.bean.UserBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface IUserMapper extends BaseMapper<UserBean> {
    public void addRoleList(@Param("userId") int roleId,
                             @Param("roleArray") int[] roleArray);
    public void updateRole(@Param("userId") int userId,
                            @Param("roleArray") int[] roleArray);

    public UserBean findById(int userId);

    @Delete("delete from t_user_role where fk_userId=#{userId};" +
            "delete from t_role_grade where fk_userId=#{userId};" +
            "delete from t_user where pk_userId=#{userId};")
    public void del(int userId);
}
